package com.hz.util;

import java.text.ParseException;
import java.util.Calendar;

public class GradeList {
    //根据当前日期获取已有的年级
    public static int[] getGradeList() throws ParseException {
       int [] grade =new int[5];
       Calendar g = Calendar.getInstance();
       int year=(int)g.get(Calendar.YEAR);
       int month = g.get(Calendar.MONTH) + 1;
       int day = g.get(Calendar.DATE);
       if(month*100+day<831){//判断是否早于08-31
	    for(int i=0;i<5;i++){
		grade[i]=year-1;
		year--;
	    }
	    return grade;
	}
	else {
	    for(int i=0;i<5;i++){
		grade[i]=year;
		year--;
	    }
	    return grade;
	}
    }
   
    
    public static void main(String args[]) throws ParseException {
	int grade[] = getGradeList();
	
	for(int i=0;i<grade.length;i++){
	    System.out.println(grade[i]);
	}
    }

}
